package org.example.handler;

import org.example.vo.TenantVo;

/**
 * @version V1.0
 * @description: TODO
 * @author: 宏伟数科-刘冬冬
 * @contact: QQ791156095
 * @date: 2020/3/9 14:03
 * @Copyright 该项目由宏伟数科版权所有，未经过允许的情况下，私自分享视频和源码属于违法行为。
 */
public class TenantContextHolder {

    private static final ThreadLocal<TenantVo> TENANT_CONTEXT = new ThreadLocal<>();

    public static void setTenant(TenantVo tenant){
        TENANT_CONTEXT.set(tenant);
    }

    public static TenantVo getTenant(){
        return TENANT_CONTEXT.get();
    }

    public static void clear(){
        TENANT_CONTEXT.remove();
    }

}
